﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using xplang.abstractions;
using xplang.run;
using xplang.expression;
using xplang.errors;

namespace xplang.rtl.operators
{

  public class ComparableClass : NativeClass
  {

    public const String opGT = ">";
    public const String opLT = "<";
    public const String opGE = ">=";
    public const String opLE = "<=";

    public ClassMethod mGT;
    public ClassMethod mLT;
    public ClassMethod mGE;
    public ClassMethod mLE;

    public ComparableClass()
      : base(RTL.rtl, "Comparable")
    {
      genericParams = new GenericParamDecl[] 
      { 
        xplang.rtl.RTL.rightParamType
      };
      inheritance = new ClassRef[] { };
    }

    public override void registerMembers()
    {
      mGT = new NativeClassMethod(this, Modifier.None,
        xplang.rtl.RTL.booleanClass.getRef(null),
        opGT,
        new Variable[] { xplang.rtl.RTL.rightParam });
      methods.Add(mGT);

      mGE = new NativeClassMethod(this, Modifier.None,
        xplang.rtl.RTL.booleanClass.getRef(null),
        opGE,
        new Variable[] { xplang.rtl.RTL.rightParam });
      methods.Add(mGE);

      mLT = new NativeClassMethod(this, Modifier.None,
        xplang.rtl.RTL.booleanClass.getRef(null),
        opLT,
        new Variable[] { xplang.rtl.RTL.rightParam });
      methods.Add(mLT);

      mLE = new NativeClassMethod(this, Modifier.None,
        xplang.rtl.RTL.booleanClass.getRef(null),
        opLE,
        new Variable[] { xplang.rtl.RTL.rightParam });
      methods.Add(mLE);

    }

    public override object newInstance()
    {
      throw new AbstractInstanciation();
    }

    public override Value getAttributeValue(Value _this, Variable variable)
    {
      throw new NotImplementedException();
    }

    public override void setAttributeValue(Value _this, Variable variable, Value obj)
    {
      throw new NotImplementedException();
    }
  }
}
